<?php
/**
 * some form functions, allows for the loading of froms
 * 
 * 
 * @author			wil hamilton <wil.hamilton@gmail.com>
 * @version 		0.2
 * @license			bsd
 */

class form {
	
	public static function postValue($post)
	{
		if(isset($_POST[$post]))
		{
			return $_POST[$post];
		}
	}
	
	public static function dispErrors($errors)
	{
		$show = '';
		foreach ($errors as $error)
		{
			$show .= '<p class="error">' .  language_phrase::get($error) . '</p>';
		}
		
		return $show;
	
	}
	
	
	public function getForm($name, $args)
	{
		$name = explode('_', $name);
		include(ROOT . 'modules/' . $name[0] . '/form.php');
		return call_user_func_array(array($name[0] . 'Forms', $name[1]), $args);
	}
	
	public function textarea($name, $value /* put args here */)
	{
		global $plugins;
		
		foreach($plugins['forms']['textarea'] as $plugin)
		{
			$string = plugin::load($plugin, array($name, $value /*put args here */ ));
		}
		
		return $string;
	}

	public function date($value)
	{
		global $plugins;
		
		foreach($plugins['forms']['date'] as $plugin)
		{
			$string = plugin::load($plugin, array($value));
		}
		
		return $string;
	}
}
?>